package ooDay04;

public class StaticMethod {
    int a;
    static int b;
    StaticMethod(){
        a=1;
        b=2;
    }
    StaticMethod(int a){
        this.a=a;
        b=2;
    }

    void show(){
        System.out.println(this.a);
        System.out.println(StaticMethod.b);
        //test();
    }
    public static void test(){
        //System.out.println(a);//静态不能直接访问实例成员
        StaticMethod staticMethod = new StaticMethod();
        staticMethod.show();
        System.out.println("静态方法"+StaticMethod.b);
    }
}

class StaticMethodTest{
    public static void main(String[] args) {
        StaticMethod staticMethod = new StaticMethod(5);
        staticMethod.show();
        staticMethod.test();
        staticMethod.show();
    }
}
